#include<iostream>
#include<string>
using namespace std;

class calculator
{
public:
	int getresult(string oper)
	{
		if (oper == "+") {
			return num1+num2;
		}
		else if (oper == "-") {
			return num1 - num2;
		}
		else if (oper == "*") {
			return num1* num2;
		}
	}


	int num1;
	int num2;
};

class calculator2
{
public:
	virtual int getresult()
	{
		return 0;
	}


	int num1=0;
	int num2=0;
};

class add :public calculator2 {
	 int getresult()
	{
		return num1 + num2;;
	}
};
class sub :public calculator2 {
	int getresult()
	{
		return num1 -num2;;
	}
};
class mul:public calculator2 {
	int getresult()
	{
		return num1* num2;;
	}
};
void test02() {
	calculator c1;
	c1.num1 = 10;
	c1.num2 = 10;
	cout << c1.num1 << "+" << c1.num2 << "="<<c1.getresult("+")<<endl;
	cout << c1.num1 << "-" << c1.num2 << "=" << c1.getresult("-") << endl;
	cout << c1.num1 << "*" << c1.num2 << "=" << c1.getresult("*") << endl;
}
void test03() {
	calculator2* abc = new add;
	abc->num1 = 100;
	abc->num2 = 10;
	cout << abc->num1 << "+" <<abc->num2 << "=" << abc->getresult() << endl;

	delete abc;
	abc = new sub;
	abc->num1 = 100;
	abc->num2 = 10;
	cout << abc->num1 << "-" << abc->num2 << "=" << abc->getresult() << endl;
}
int main2() {

	test03();
	system("pause");
	return 0;
}